<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Sql命令行工具</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="Author" content="larry" />
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="Shortcut Icon" href="/favicon.ico" />
    <link rel="stylesheet" type="text/css" href="/static/admin/common/layui/css/layui.css" media="all">
    <link rel="stylesheet" type="text/css" href="/static/admin/backstage/css/base.css" media="all">
    <link rel="stylesheet" type="text/css" href="/static/admin/common/css/animate.css" media="all">
    <link rel="stylesheet" type="text/css" href="/static/admin/backstage/css/admin.css" media="all">
</head>
<body>
<div class="layui-fluid">
    <div class="larry-container larryms-admin">
        <div class="layui-row layui-col-space20">
            <div class="layui-col-xs12 animated fadeInRightBig">
                <section class="larry-panel">
                    <div class="larryms-page-header">
                        <span class="tit">Sql命令行工具</span>
                    </div>
                    <div class="larryms-page-body">
                        <form class="layui-form" enctype="multipart/form-data">
                            <textarea name="sql" class="layui-textarea" style="height:300px;margin-bottom: 20px"></textarea>
                            <div class="layui-input-block">
                                <button class="layui-btn" lay-submit lay-filter="sql">立即提交</button>
                                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                            </div>
                            <div class="layui-form-item"></div>
                        </form>
                    </div>
                </section>
            </div>
        </div>
    </div>
</div>
<!-- 加载js文件-->
<script type="text/javascript" src="/static/admin/common/layui/layui.js"></script>
<script>
    layui.use(['form','jquery','layer'], function(){
        var $ = layui.jquery
            ,upload = layui.upload;
        var form = layui.form;
        //ajax表单提交
        form.on('submit(sql)', function(data){

            $.ajax({
                type:"POST",
                url:"{:url('admin/sql/import')}",
                dataType:"JSON",
                data:data.field,
                success:function(res){
                    if(res.code == '1'){
                        layer.msg(res.msg, {icon: 6});
                        $('.layui-form-item').html(res.result);
                    }else{
                        layer.msg(res.msg, {icon: 5});
                        $('.layui-form-item').html('');
                    }

                }
            });
            return false;
        });
    });
</script>
</body>
</html>